<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>父组件向子组件传递数据</title>
</head>
<body>
    <div id="app">
        <cpn v-bind:cmovies="movies" :cmessage="message"></cpn>
    </div>

</body>
    <template id="cpn">
        <div>
            <h1>{{cmessage}}</h1>
            <ul>
                <li v-for="item in cmovies">{{item}}</li>
            </ul>
        </div>
    </template>
    <script src="../js/vue.js"></script>
    <script>

        const cpn = {
            template: '#cpn',
            //props: ['cmovies','cmessage'],
            props: {
                // cmovies: Array,
                // cmessage: String,
                cmessage: {
                    type: String,
                    default: '默认值',
                    required: true,
                },
                cmovies: {
                    type: Array,
                    default (){
                        return ['数组默认数据']
                    },
                }
            },
            data () {
                return {}
            },
            methods: {

            },
        }

        const app = new Vue({
            el: '#app',
            data: {
                message: 'hello',
                movies: ['海王','海贼王','海尔兄弟'],
            },
            methods: {

            },
            components: {
                cpn
            }
        })
    </script>
</html>